﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using com.cgWorkstudio.BIMP.Library.Properties;

namespace com.cgWorkstudio.BIMP.Library.uc {
    public enum IndexButtonType {
        MryGuanli,Mryrcw,Mryml,Mryqy
    }
    public partial class UC_IndexPicButton:UserControl {        
        IndexButtonType _BTNType = IndexButtonType.MryGuanli;
        [Description("按钮类型")]
        public IndexButtonType BTNType {
            get {
                return _BTNType;
            }
            set {
                _BTNType = value;
                checkPic();           
            }
        }
        public UC_IndexPicButton() {
            InitializeComponent();
            this.showPic.MouseMove += new MouseEventHandler(UC_IndexButton_MouseMove);
            this.showPic.MouseLeave += new EventHandler(UC_IndexButton_MouseLeave);
        }

        void UC_IndexButton_MouseLeave(object sender,EventArgs e) {
            mouseMoving = false;
            this.BackgroundImage = null;
        }

       
        void UC_IndexButton_MouseMove(object sender,MouseEventArgs e) {
            if(mouseMoving == true) {
                return;
            }
            mouseMoving = true;
            this.BackgroundImage = Resources.IndexButton_Hover;
        }
        bool mouseMoving = false;
        void checkPic() {
            switch(BTNType) {
                case IndexButtonType.MryGuanli:
                    this.showPic.Image = Resources.IndexButton_Mryglw_Default;
                    break;
                case IndexButtonType.Mryml:
                    this.showPic.Image = Resources.IndexButton_Mryml_Default;
                    break;
                case IndexButtonType.Mryqy:
                    this.showPic.Image = Resources.IndexButton_Mry_Default;
                    break;
                case IndexButtonType.Mryrcw:
                    this.showPic.Image = Resources.IndexButton_Mryrcw_Default;
                    break;
            }
        }
    }
}
